/*
 *
 *    Copyright (c) 2022 Project CHIP Authors
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

// THIS FILE IS GENERATED BY ZAP
// This file is generated from clusters-Structs.h.zapt

#pragma once

#include <app/data-model/DecodableList.h>
#include <app/data-model/List.h>
#include <app/data-model/Nullable.h>
#include <lib/core/DataModelTypes.h>
#include <lib/core/Optional.h>
#include <lib/core/TLV.h>
#include <lib/support/BitMask.h>

#include <clusters/shared/Structs.h>

#include <cstdint>

namespace chip
{
namespace app
{
	namespace Clusters
	{
		namespace PushAvStreamTransport
		{
			namespace Structs
			{
				namespace TransportMotionTriggerTimeControlStruct
				{
					enum class Fields : uint8_t {
						kInitialDuration = 0,
						kAugmentationDuration = 1,
						kMaxDuration = 2,
						kBlindDuration = 3,
					};

					struct Type {
					public:
						uint16_t initialDuration = static_cast<uint16_t>(0);
						uint16_t augmentationDuration = static_cast<uint16_t>(0);
						uint32_t maxDuration = static_cast<uint32_t>(0);
						uint16_t blindDuration = static_cast<uint16_t>(0);

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					using DecodableType = Type;

				} // namespace TransportMotionTriggerTimeControlStruct
				namespace TransportZoneOptionsStruct
				{
					enum class Fields : uint8_t {
						kZone = 0,
						kSensitivity = 1,
					};

					struct Type {
					public:
						DataModel::Nullable<uint16_t> zone;
						Optional<uint8_t> sensitivity;

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					using DecodableType = Type;

				} // namespace TransportZoneOptionsStruct
				namespace TransportTriggerOptionsStruct
				{
					enum class Fields : uint8_t {
						kTriggerType = 0,
						kMotionZones = 1,
						kMotionSensitivity = 2,
						kMotionTimeControl = 3,
						kMaxPreRollLen = 4,
					};

					struct Type {
					public:
						TransportTriggerTypeEnum triggerType =
							static_cast<TransportTriggerTypeEnum>(0);
						Optional<DataModel::Nullable<DataModel::List<
							const Structs::TransportZoneOptionsStruct::Type>>>
							motionZones;
						Optional<DataModel::Nullable<uint8_t>> motionSensitivity;
						Optional<Structs::TransportMotionTriggerTimeControlStruct::Type>
							motionTimeControl;
						Optional<uint16_t> maxPreRollLen;

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					struct DecodableType {
					public:
						TransportTriggerTypeEnum triggerType =
							static_cast<TransportTriggerTypeEnum>(0);
						Optional<DataModel::Nullable<DataModel::DecodableList<
							Structs::TransportZoneOptionsStruct::DecodableType>>>
							motionZones;
						Optional<DataModel::Nullable<uint8_t>> motionSensitivity;
						Optional<Structs::TransportMotionTriggerTimeControlStruct::DecodableType>
							motionTimeControl;
						Optional<uint16_t> maxPreRollLen;

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;
					};

				} // namespace TransportTriggerOptionsStruct
				namespace CMAFContainerOptionsStruct
				{
					enum class Fields : uint8_t {
						kCMAFInterface = 0,
						kSegmentDuration = 1,
						kChunkDuration = 2,
						kSessionGroup = 3,
						kTrackName = 4,
						kCENCKey = 5,
						kCENCKeyID = 6,
						kMetadataEnabled = 7,
					};

					struct Type {
					public:
						CMAFInterfaceEnum CMAFInterface = static_cast<CMAFInterfaceEnum>(0);
						uint16_t segmentDuration = static_cast<uint16_t>(0);
						uint16_t chunkDuration = static_cast<uint16_t>(0);
						uint8_t sessionGroup = static_cast<uint8_t>(0);
						chip::CharSpan trackName;
						Optional<chip::ByteSpan> CENCKey;
						Optional<chip::ByteSpan> CENCKeyID;
						Optional<bool> metadataEnabled;

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					using DecodableType = Type;

				} // namespace CMAFContainerOptionsStruct
				namespace ContainerOptionsStruct
				{
					enum class Fields : uint8_t {
						kContainerType = 0,
						kCMAFContainerOptions = 1,
					};

					struct Type {
					public:
						ContainerFormatEnum containerType = static_cast<ContainerFormatEnum>(0);
						Optional<Structs::CMAFContainerOptionsStruct::Type> CMAFContainerOptions;

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					using DecodableType = Type;

				} // namespace ContainerOptionsStruct
				namespace TransportOptionsStruct
				{
					enum class Fields : uint8_t {
						kStreamUsage = 0,
						kVideoStreamID = 1,
						kAudioStreamID = 2,
						kTLSEndpointID = 3,
						kUrl = 4,
						kTriggerOptions = 5,
						kIngestMethod = 6,
						kContainerOptions = 7,
						kExpiryTime = 8,
					};

					struct Type {
					public:
						Globals::StreamUsageEnum streamUsage =
							static_cast<Globals::StreamUsageEnum>(0);
						Optional<DataModel::Nullable<uint16_t>> videoStreamID;
						Optional<DataModel::Nullable<uint16_t>> audioStreamID;
						uint16_t TLSEndpointID = static_cast<uint16_t>(0);
						chip::CharSpan url;
						Structs::TransportTriggerOptionsStruct::Type triggerOptions;
						IngestMethodsEnum ingestMethod = static_cast<IngestMethodsEnum>(0);
						Structs::ContainerOptionsStruct::Type containerOptions;
						Optional<uint32_t> expiryTime;

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					struct DecodableType {
					public:
						Globals::StreamUsageEnum streamUsage =
							static_cast<Globals::StreamUsageEnum>(0);
						Optional<DataModel::Nullable<uint16_t>> videoStreamID;
						Optional<DataModel::Nullable<uint16_t>> audioStreamID;
						uint16_t TLSEndpointID = static_cast<uint16_t>(0);
						chip::CharSpan url;
						Structs::TransportTriggerOptionsStruct::DecodableType triggerOptions;
						IngestMethodsEnum ingestMethod = static_cast<IngestMethodsEnum>(0);
						Structs::ContainerOptionsStruct::DecodableType containerOptions;
						Optional<uint32_t> expiryTime;

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;
					};

				} // namespace TransportOptionsStruct
				namespace TransportConfigurationStruct
				{
					enum class Fields : uint8_t {
						kConnectionID = 0,
						kTransportStatus = 1,
						kTransportOptions = 2,
						kFabricIndex = 254,
					};

					struct Type {
					public:
						uint16_t connectionID = static_cast<uint16_t>(0);
						TransportStatusEnum transportStatus =
							static_cast<TransportStatusEnum>(0);
						Optional<Structs::TransportOptionsStruct::Type> transportOptions;
						chip::FabricIndex fabricIndex = static_cast<chip::FabricIndex>(0);

						static constexpr bool kIsFabricScoped = true;

						auto GetFabricIndex() const { return fabricIndex; }

						void SetFabricIndex(chip::FabricIndex fabricIndex_)
						{
							fabricIndex = fabricIndex_;
						}

						CHIP_ERROR EncodeForWrite(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
						CHIP_ERROR EncodeForRead(TLV::TLVWriter &aWriter, TLV::Tag aTag,
									 FabricIndex aAccessingFabricIndex) const;

					private:
						CHIP_ERROR
						DoEncode(TLV::TLVWriter &aWriter, TLV::Tag aTag,
							 const Optional<FabricIndex> &aAccessingFabricIndex) const;
					};

					struct DecodableType {
					public:
						uint16_t connectionID = static_cast<uint16_t>(0);
						TransportStatusEnum transportStatus =
							static_cast<TransportStatusEnum>(0);
						Optional<Structs::TransportOptionsStruct::DecodableType>
							transportOptions;
						chip::FabricIndex fabricIndex = static_cast<chip::FabricIndex>(0);

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = true;

						auto GetFabricIndex() const { return fabricIndex; }

						void SetFabricIndex(chip::FabricIndex fabricIndex_)
						{
							fabricIndex = fabricIndex_;
						}
					};

				} // namespace TransportConfigurationStruct
				namespace SupportedFormatStruct
				{
					enum class Fields : uint8_t {
						kContainerFormat = 0,
						kIngestMethod = 1,
					};

					struct Type {
					public:
						ContainerFormatEnum containerFormat =
							static_cast<ContainerFormatEnum>(0);
						IngestMethodsEnum ingestMethod = static_cast<IngestMethodsEnum>(0);

						CHIP_ERROR Decode(TLV::TLVReader &reader);

						static constexpr bool kIsFabricScoped = false;

						CHIP_ERROR Encode(TLV::TLVWriter &aWriter, TLV::Tag aTag) const;
					};

					using DecodableType = Type;

				} // namespace SupportedFormatStruct
			} // namespace Structs
		} // namespace PushAvStreamTransport
	} // namespace Clusters
} // namespace app
} // namespace chip
